package com.softeem.math;

import java.util.Random;

public class Math_03 {
    public static void main(String[] args) {
        Random random = new Random();
        double d1 = random.nextDouble();// 0 ~ 1之间的小数
        System.out.println("d1 = " + d1);

        int d2 = random.nextInt();//取int类型范围之内的所有数据
        System.out.println("d2 = " + d2);

        int d3 = random.nextInt(100);//如果添加了参数,生成0 ~ bound之间的随机数
        System.out.println("d3 = " + d3);

        //Math中的random()方法来自于Random类
        double b1 = Math.random();//0 ~ 1之间的小数

        int num = (int)(Math.random() * 100);
        System.out.println(num);

    }
}
